package br.com.fox.iebav.dao;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.Stateless;
import javax.persistence.Query;
import br.com.fox.iebav.dao.abstractdao.AbstractDAO;
import br.com.fox.iebav.entity.Lotes;

@Stateless
public class LoteDAO extends AbstractDAO {
	
	private Query q = null;

	public List<Lotes> findAll(int idLicitacao)
	{
		q = entityManager.createQuery("FROM Lotes WHERE lote="+idLicitacao);
		@SuppressWarnings("unchecked")
		List<Lotes> list = q.getResultList();
		if(list.isEmpty())
			return new ArrayList<Lotes>();
		return list;
	}

	public List<Lotes> findAll()
	{
		q = entityManager.createQuery("FROM Lotes");
		@SuppressWarnings("unchecked")
		List<Lotes> list = q.getResultList();
		if(list.isEmpty())
			return new ArrayList<Lotes>();
		return list;
	}
}
